package cn.blackbirds.blocks;

import com.openfeint.api.resource.Leaderboard;
import com.openfeint.api.resource.Score;

import android.app.Activity;
import android.widget.Toast; // Used for presenting diagnostic messages.

public class OpenFeintLeaderboard extends Activity{
	
	public void sendScore(long score){
		long scoreValue = score;
		Score s = new Score(scoreValue, null); // Second parameter is null to indicate that custom display text is not used.
		Leaderboard l = new Leaderboard("1046237");
		s.submitTo(l, new Score.SubmitToCB() {
			@Override public void onSuccess(boolean newHighScore) {
				// sweet, score was posted
				OpenFeintLeaderboard.this.setResult(Activity.RESULT_OK);
				OpenFeintLeaderboard.this.finish();
			}

			@Override public void onFailure(String exceptionMessage) {
				Toast.makeText(OpenFeintLeaderboard.this,
				"Error (" + exceptionMessage + ") posting score.",
				Toast.LENGTH_SHORT).show();
				OpenFeintLeaderboard.this.setResult(Activity.RESULT_CANCELED);
				OpenFeintLeaderboard.this.finish();
			}
		});
	}

	
}
